//
//  CZQShareViewController.m
//  coachmanage
//
//  Created by 众拳科技 on 2018/3/22.
//  Copyright © 2018年 众拳科技. All rights reserved.
//

#import "CZQShareViewController.h"
#import "CZQHomeShareView.h"
#import "ShareAlertView.h"
@interface CZQShareViewController ()

@property(nonatomic,weak)CZQHomeShareView *shareView;

@end

@implementation CZQShareViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = BackGroundColor;
    
    self.title = @"分享";
    
    //右侧图片 icon_nbarmore
    UIBarButtonItem *rightButtonItem = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"icon_close"]
                                                                               imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] style:UIBarButtonItemStylePlain target:self action:@selector(pop)];
    self.navigationItem.rightBarButtonItem = rightButtonItem;
    
    [self createSubView];
    
    // Do any additional setup after loading the view.
}

#pragma mark 创建子视图
-(void)createSubView{
    
    WS(weakSelf);
    
    
    CZQHomeShareView *shareView = [CZQHomeShareView new];
    [self.view addSubview:shareView];
    self.shareView = shareView;
    
    [self.shareView mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.top.bottom.mas_equalTo(self.view);
        make.left.mas_equalTo(self.view).offset(10);
        make.right.mas_equalTo(self.view).offset(-10);
        
    }];
    
    [shareView.continuBtn addTarget:self action:@selector(share)];
    
    NSArray *arrM = @[@"手法十分大方",@"sfsafsaf",@"发生的发生"];
    
    [shareView.shopTagView removeAllTags];
    // 开始加载
    [arrM enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        // 初始化标签
        SKTag *tag = [[SKTag alloc] initWithText:arrM[idx]];
        // 标签相对于自己容器的上左下右的距离
        tag.padding = UIEdgeInsetsMake(10, 5, 10, 5);
        // 弧度
        tag.cornerRadius = 3.0f;
        // 字体
        tag.font = [UIFont boldSystemFontOfSize:13];
        // 边框宽度
        tag.borderWidth = 1;
        // 背景
        //        tag.bgColor = [UIColor colorWithRed:244/255.0 green:244/255.0 blue:244/255.0 alpha:1];
        // 边框颜色
        tag.borderColor = CSColorFromRGB(0xdbdbdb);
        // 字体颜色
        tag.textColor = BlackColor;
        // 是否可点击
        tag.enable = YES;
        // 加入到tagView
        [weakSelf.shareView.shopTagView addTag:tag];
    }];
    
//    [self.view setNeedsLayout];
//    [self.view layoutIfNeeded];
    
}
#pragma mark 返回
-(void)pop{
    
    [self.navigationController popViewControllerAnimated:YES];
}

#pragma mark 分享
-(void)share
{
    
    ShareAlertView *shareAlertView = [[ShareAlertView alloc] init];
    shareAlertView.weChatBtn.tag = 0;
    shareAlertView.friendBtn.tag = 1;
    shareAlertView.linkBtn.tag = 2;
    [shareAlertView.weChatBtn addTarget:self action:@selector(shareBtnClick:)];
    [shareAlertView.friendBtn addTarget:self action:@selector(shareBtnClick:)];
    [shareAlertView.linkBtn addTarget:self action:@selector(shareBtnClick:)];
    [shareAlertView showWithAnimation];
    
}
-(void)shareBtnClick:(UIButton *)sender
{
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
